﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using IndoReputation.Models.BusinessObject;
using IndoReputation.Commons;

namespace IndoReputation.Views.ViewModels
{
    public class MediaViewModel
    {
        [Required]
        public int ID
        {
            set;
            get;
        }

        [Required]
        [Display(Name = "Media Category")]
        public int MediaCategoryID
        {
            set;
            get;
        }
        public IEnumerable<SelectListItem> MediaCategory { get; set; }

        [Required(ErrorMessage = "Please type the Name")]
        [StringLength(256, ErrorMessage = "String may not be longer than 256 characters")]
        [PlaceHolder("Enter name here")]
        public string Name
        {
            set;
            get;
        }

        [Display(Name = "Name")]
        [StringLength(256, ErrorMessage = "String may not be longer than 256 characters")]
        [PlaceHolder("Enter name of Chief Editor here")]
        public string ChiefEditorName
        {
            set;
            get;
        }

        [Display(Name = "Mobile number")]
        [StringLength(256, ErrorMessage = "String may not be longer than 256 characters")]
        [PlaceHolder("Enter mobile of Chief Editor here")]
        public string ChiefEditorMobile
        {
            set;
            get;
        }

        [RegularExpression(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", ErrorMessage = "Please enter valid e-mail adress")]
        [DataType(DataType.EmailAddress)]
        [Display(Name = "E-mail")]
        [StringLength(256, ErrorMessage = "String may not be longer than 256 characters")]
        [PlaceHolder("Enter email of Chief Editor here")]
        public string ChiefEditorEmail
        {
            set;
            get;
        }

        [StringLength(256, ErrorMessage = "String may not be longer than 256 characters")]
        [Display(Name = "Street Name")]
        [PlaceHolder("Enter name of street address here")]
        public string AddStreetName
        {
            set;
            get;
        }

        [StringLength(256, ErrorMessage = "String may not be longer than 256 characters")]
        [Display(Name = "Street Number")]
        [PlaceHolder("Enter number of address here")]
        public string AddStreetNumber
        {
            set;
            get;
        }

        [Display(Name = "Building name of the office")]
        [StringLength(256, ErrorMessage = "String may not be longer than 256 characters")]
        [PlaceHolder("Enter name of building here")]
        public string AddBuildingName
        {
            set;
            get;
        }

        [Display(Name = "City")]
        [PlaceHolder("Enter name of city here")]
        public string AddCity
        {
            set;
            get;
        }
        public IEnumerable<string> City { get; set; }

        [Display(Name = "Country")]
        [PlaceHolder("Enter name of country here")]
        public string AddCountry
        {
            set;
            get;
        }
        public IEnumerable<string> Country { get; set; }

        [Display(Name = "Phone")]
        [StringLength(256, ErrorMessage = "String may not be longer than 256 characters")]
        [PlaceHolder("Enter number of phone address here")]
        public string AddPhone
        {
            set;
            get;
        }

        [Display(Name = "Fax")]
        [StringLength(256, ErrorMessage = "String may not be longer than 256 characters")]
        [PlaceHolder("Enter number of fax here")]
        public string AddFax
        {
            set;
            get;
        }

        [RegularExpression(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", ErrorMessage = "Please enter valid e-mail adress")]
        [DataType(DataType.EmailAddress)]
        [Display(Name = "E-mail")]
        [StringLength(256, ErrorMessage = "String may not be longer than 256 characters")]
        [PlaceHolder("Enter email of email address here")]
        public string AddEmail
        {
            set;
            get;
        }

        [Display(Name = "Website url")]
        [StringLength(256, ErrorMessage = "String may not be longer than 256 characters")]
        [PlaceHolder("Enter name of website here")]
        public string AddWebsite
        {
            set;
            get;
        }

        //public JsonResult ListReporter { get; set; }

        [Display(Name = "When it was first time launched")]
        public DateTime? FirstTimeLaunched
        {
            set;
            get;
        }

        [Range(1, Int64.MaxValue, ErrorMessage = "The number is too big or too small")]
        public Int64? TotalPublishedDaily
        {
            set;
            get;
        }
        [Range(1, Int64.MaxValue, ErrorMessage = "The number is too big or too small")]
        public Int64? TotalViewersDaily
        {
            set;
            get;
        }

        [Required(ErrorMessage = "Please choose the reader, listener, viewer or user in Private information Tab")]
        public int ViewerTypeID
        {
            set;
            get;
        }
        public IEnumerable<SelectListItem> ViewerType { get; set; }

        [Range(1, Int64.MaxValue, ErrorMessage = "The number is too big or too small")]
        [Display(Name = "If it has on line news, how many users?")]
        public Int64? TotalUsers
        {
            set;
            get;
        }

        [Required]
        [Display(Name = "Ownership. It belong to:")]
        public int OwnershipTypeID
        {
            set;
            get;
        }
        public IEnumerable<SelectListItem> OwnershipType { get; set; }

        [Required]
        [Display(Name = "What is its orientation?")]
        public int OrientationTypeID
        {
            set;
            get;
        }
        public IEnumerable<SelectListItem> OrientationType { get; set; }

        [Required]
        public byte IsFreedom
        {
            set;
            get;
        }

        [Required]
        [Display(Name = "Can it freely express it’s right of freedom of expression")]
        public string StrFreedom
        { get; set; }
        public IEnumerable<SelectListItem> Freedom { get; set; }

        [Required]
        [Display(Name = "How strong is its influence to the decision makers?")] 
        public int StrongInfluenceTypeID
        {
            set;
            get;
        }
        public IEnumerable<SelectListItem> StrongInfluenceType { get; set; }

        [Required]
        [Display(Name = "How can you rank this media based on the above information?")]
        public int RankTypeID
        {
            set;
            get;
        }
        public IEnumerable<SelectListItem> RankType { get; set; }

        [DataType(DataType.MultilineText)]
        [StringLength(512, ErrorMessage = "String may not be longer than 512 characters")]
        [PlaceHolder("Enter description here")]
        public string Description
        {
            set;
            get;
        }
        public DateTime? CreateAt
        {
            set;
            get;
        }
        public int? CreateBy
        {
            set;
            get;
        }
        private bool _IsEnable = true;
        [Display(Name = "Status")]
        public bool IsEnable
        {
            set { _IsEnable = value; }
            get { return _IsEnable; }
        }

        public IList<Reporter> ListReporter { get; set; }
        public string ListReporterOrginalString { get; set; }
        public string InputJsonMediaShort { get; set; }
    }
}